import request from '@/utils/request'



export default {
    //查询全部
    getDiariesList(searchModel) {
        return request({
            url: '/personalDiaries/list',
            method: 'get',

            params: {
                pageNo: searchModel.pageNo,
                pageSize: searchModel.pageSize,
                createDate: searchModel.createDate,
                title: searchModel.title,
                tags: searchModel.tags,
                mood: searchModel.mood
            }
        });
    },
    //新增
    addpersonalDiaries(personalDiaries) {
        return request({
            url: '/personalDiaries',
            method: 'post',
            data: personalDiaries
        });
    },
    //删除
    delletepersonalDiaries(id) {
        return request({
            url: `/personalDiaries/${id} `,
            method: 'delete',

        });
    },
    //修改
    updatepersonalDiaries(personalDiaries) {
        return request({
            url: '/personalDiaries',
            method: 'put',
            data: personalDiaries
        });
    },
    //查询  by  id
    getpersonalDiariesById(id) {
        return request({
            url: `/personalDiaries/${id} `,
            method: 'get',

        });
    },
    savepersonalDiaries(personalDiaries) {
        if(personalDiaries.id==null && personalDiaries.id==undefined){
        return this.addpersonalDiaries(personalDiaries);
        }
         return this.updatepersonalDiaries(personalDiaries);   
       
    },
    

}